from django.http import HttpResponse
from django.shortcuts import render


def hello(request):
    return HttpResponse("Hello world ! ")


def runoob(request):
    context = {}
    context['hello'] = 'Hello World!'
    #return render(request, 'runoob.html', context)
    views_list = ["菜鸟教程1", "菜鸟教程2", "菜鸟教程3"]
    return render(request, "runoob.html", {"views_list": views_list})


def ShowHome(request):
    return render(request, 'Hello.html')


def index(request):
    return render(request, 'index.html')


def index1(request):
    return render(request, 'add.html')


def add(request):
    print(request.POST)
    if request.method == 'POST':
        i1 = int(request.POST.get('i1'))
        i2 = int(request.POST.get('i2'))
        i3 = int(request.POST.get('i3'))
        if i1*i2 == i3:
            return HttpResponse('correct')
        else:
            return HttpResponse('wrong')

